package cn.lgp6.ziyou_util.common.exception;

import cn.lgp6.ziyou_util.common.result.RequestResult;
import cn.lgp6.ziyou_util.common.result.RequestResultBuilder;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionHandlerController {
    @ExceptionHandler(value = Exception.class)
    public RequestResult exceptionHandler(Exception e){
        System.out.println("异常:"+e.getLocalizedMessage());
        return RequestResultBuilder.error("程序异常,异常信息:"+e.getLocalizedMessage());
    }

}
